import java.util.Arrays;
import java.util.Scanner;

/**
 * @Description
 */

public class Test {

    public static int[] add(int[]array,int target){
        int flg = 1;
        int[]arr = new int[]{-1,-1};
        for (int i = 0; i < array.length-1; i++) {
            for(int j = i+1;j<array.length-1-i;j++){
                if(array[i]+array[j]==target){
                    arr[0] = i;
                    arr[1] = j;
                    flg = -1;
                    break;

                }
                if(flg==-1){
                    break;
                }
            }
        }
        return arr;

    }

    public static void main(String[] args) {
        int[] array = new int[]{2,4,1,3};
        Scanner scanner = new Scanner(System.in);
        int target = scanner.nextInt();
        int[] ret = add(array,target);
        System.out.println(Arrays.toString(ret));
    }
}
